package org.rcy.framework.rpc.service;


import org.rcy.framework.rpc.base.RPC;

/**
 * 用于server端暴露服务的时候创建Service对象
 * @author zhouree
 *
 */
public class ServerService extends AbstractRpcService{
	
	private static final long serialVersionUID = 1L;

	private Object handler;

	/**
	 * 使用默认参数创建ServerService对象
	 * @param serviceImpl
	 * @throws Exception
	 */
	public ServerService(Object serviceImpl) throws Exception {
		this(RPC.DEFAULT_GROUP,RPC.DEFAULT_VERSION, serviceImpl);
	}

	/**
	 * 用于server端暴露服务的时候创建Service对象
	 * @param group
	 * @param serviceImpl 要暴露的服务实现类
	 * @throws Exception
	 */
	public ServerService(String group, String version,Object serviceImpl) throws Exception {
		super(group,version);
		this.handler = serviceImpl;
		Class<?> serviceClass = ServiceClassResolver.resolve(serviceImpl);
		setServiceClass(serviceClass);
	}


	@Override
	public Object getHandler() {
		return handler;
	}

	public void setHandler(Object handler) {
		this.handler = handler;
	}
}
